WOLF core
WOLF: A Modular Estimation Framework for Robotics
XXXXXXXXXXXXXXXXXXXXXXXXvoid(0)" frameborder="0" name="MSearchResults" id="MSearchResults">
motion_provider.h
Go to the documentation of this file.
1// WOLF - Copyright (C) 2020-2026
2// Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
3// Authors: Joan Solà Ortega (jsola@iri.upc.edu) and
4// Joan Vallvé Navarro (jvallve@iri.upc.edu)
5// All rights reserved.
6//
7// This file is part of WOLF: http://www.iri.upc.edu/wolf
8// WOLF is free software: you can redistribute it and/or modify
9// it under the terms of the GNU General Public License version 3
10// as published by the Free Software Foundation.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program. If not, see <http://www.gnu.org/licenses/>.
19#pragma once
20
21#include "core/common/wolf.h"
24#include "yaml-cpp/yaml.h"
25
26namespace wolf
27{
28class TimeStamp;
29
31
36{
37 public:
44 MotionProvider(const TypeComposite& _state_types, const YAML::Node& _params);
45
47 virtual ~MotionProvider();
48
49 // Queries to the processor
52 virtual TimeStamp getTimeStamp() const = 0;
53
58 virtual VectorComposite getState(StateKeys _keys = "") const = 0;
59
65 virtual VectorComposite getState(const TimeStamp& _ts, StateKeys _keys = "") const = 0;
66
70
73 void setOdometry(const VectorComposite&);
74
77 bool isStateProvider() const;
78
81 unsigned int getOrder() const;
82
85 void setOrder(unsigned int);
86
87 protected:
91 void addTypes(const TypeComposite& _state_types);
92
94 unsigned int state_provider_order_;
95
96 private:
97 TypeComposite state_types_;
98 VectorComposite odometry_;
99 mutable std::mutex mut_odometry_;
100};
101
102} // namespace wolf
103
105namespace wolf
106{
108
110{
111 return is_state_provider_;
112}
113
114inline unsigned int MotionProvider::getOrder() const
115{
116 if (not isStateProvider())
117 throw std::runtime_error("MotionProvider::getOrder: not a motion provider, doesn't have order");
119}
120
121inline void MotionProvider::setOrder(unsigned int _order)
122{
123 if (not isStateProvider())
124 throw std::runtime_error("MotionProvider::getOrder: not a motion provider, cannot have order");
125 state_provider_order_ = _order;
126}
127
128} /* namespace wolf */
Interface of the processors providing motion: the state at any time stamp (and odometry)....
Definition: motion_provider.h:36
virtual ~MotionProvider()
Destructor.
Definition: motion_provider.h:107
virtual VectorComposite getState(const TimeStamp &_ts, StateKeys _keys="") const =0
Returns the state at a time stamp.
void setOdometry(const VectorComposite &)
Sets the odometry (all the keys of the motion provider are required)
Definition: motion_provider.cpp:57
virtual TimeStamp getTimeStamp() const =0
Returns the time stamp of the last motion.
void addTypes(const TypeComposite &_state_types)
Adds the types of the states provided (with identity odometry). Throws if a key already has a differe...
Definition: motion_provider.cpp:32
VectorComposite getOdometry() const
Returns the odometry.
Definition: motion_provider.cpp:85
unsigned int state_provider_order_
If a state provider, the order to be used by the problem.
Definition: motion_provider.h:94
virtual VectorComposite getState(StateKeys _keys="") const =0
Returns the state at the time stamp of the last motion.
unsigned int getOrder() const
Returns the order of the state provider to be used by the problem. Throws if not a state provider.
Definition: motion_provider.h:114
MotionProvider(const TypeComposite &_state_types, const YAML::Node &_params)
Constructor.
Definition: motion_provider.cpp:25
bool isStateProvider() const
Returns whether the motion provider is configured as a state provider.
Definition: motion_provider.h:109
bool is_state_provider_
Whether this motion provider is configured as a state provider.
Definition: motion_provider.h:93
void setOrder(unsigned int)
Sets the order of the state provider to be used by the problem. Throws if not a state provider.
Definition: motion_provider.h:121
TimeStamp implements basic functionalities for time stamps.
Definition: time_stamp.h:39
Composite of state vectors.
Definition: vector_composite.h:29
Definition: capture_base.h:23
std::string StateKeys
Definition: composite.h:31
WOLF_PTR_TYPEDEFS(CaptureLandmarksExternal)